﻿
using GoodDotNet.Data.Models;
using GoodDotNet.Core.Model;
using GoodDotNet.Core.Model.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GoodDotNet.Service
{
    public class ResultService
    {
        /// <summary>
        /// 成功
        /// </summary>
        /// <param name="result"></param>
        /// <returns></returns>
        public static Result Sucess(object result)
        {
            return new Result
            {
                code =EnumErrorCode.ErrorCode.Sucess,
                result = result
            };
        }
        /// <summary>
        /// 捕获的错误
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        public static Result CatchError(string message)
        {
            return new Result
            {
                code = EnumErrorCode.ErrorCode.CatchError,
                result = message
            };
        }
        /// <summary>
        /// 签名错误
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        public static Result SignError(string message)
        {
            return new Result
            {
                code = EnumErrorCode.ErrorCode.SignError,
                result = message
            };
        }
        /// <summary>
        /// 没有登录
        /// </summary>
        /// <returns></returns>
        public static Result NoLogin()
        {
            return new Result
            {
                code = EnumErrorCode.ErrorCode.NoLogin,
                result = "您还没有登录"
            };
        }
        
        /// <summary>
        /// 没有权限
        /// </summary>
        /// <returns></returns>
        public static Result PermissionDenied()
        {
            return new Result
            {
                code = EnumErrorCode.ErrorCode.PermissionDenied,
                result = "你没有权限"
            };
        }
      
        /// <summary>
        /// 一般错误
        /// </summary>
        /// <param name="message">错误信息</param>
        /// <returns></returns>

        public static Result Error(string message)
        {
            return new Result
            {
                code = EnumErrorCode.ErrorCode.Error,
                result = message
            };
        }

    }
}
